﻿using System.Collections.Generic;
using System.Linq;
using DataAccess.Services;

namespace BusinessLogic.Mappers.CurrencyConversion
{
	internal class CurrencyConversionMapper : MapperBase<BusinessEntity.Entities.CurrencyConversion, DataControl.Cur_exchange>, ICurrencyConversionMapper
	{
		public CurrencyConversionMapper(IServiceManager serviceManager, IMapping<BusinessEntity.Entities.CurrencyConversion, DataControl.Cur_exchange> mapping, IGatewayBase<DataControl.Cur_exchange> gatewayBase)
			: base(serviceManager, gatewayBase, mapping)
		{
		}

		public decimal? Get(string currencyCode1, string currencyCode2)
		{
			return ServiceManager.CurrencyConversion.GetForCurrencies(currencyCode1, currencyCode2);
		}

		public IEnumerable<BusinessEntity.Entities.CurrencyConversion> GetAll()
		{
			return ServiceManager.CurrencyConversion.GetAll().Select(x => Mapping.ToBE(x));
		}
	}
}
